From ff375eb4ab2fd515a31d1cbd02a3b7505da9a4b4 Mon Sep 17 00:00:00 2001 From: Greg Maxwell Date: Sat, 27 Oct 2007 05:47:28 +0000 Subject: [PATCH] This commit adds an option to Special:Newpages to hide new pages created by logged-in users. --- includes/SpecialNewpages.php | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 220e77fdf4..d5305f5f0f 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -12,10 +12,12 @@ class NewPagesPage extends QueryPage { var $namespace; var $username = ''; + var $hideliu; - function NewPagesPage( $namespace = NS_MAIN, $username = '' ) { + function NewPagesPage( $namespace = NS_MAIN, $username = '', $hideliu= false ) { $this->namespace = $namespace; $this->username = $username; + $this->hideliu = $hideliu; } function getName() { @@ -28,11 +30,15 @@ class NewPagesPage extends QueryPage { } function makeUserWhere( &$dbo ) { - $title = Title::makeTitleSafe( NS_USER, $this->username ); - if( $title ) { - return ' AND rc_user_text = ' . $dbo->addQuotes( $title->getText() ); + if ($this->hideliu) { + return ' AND rc_user = 0'; } else { - return ''; + $title = Title::makeTitleSafe( NS_USER, $this->username ); + if( $title ) { + return ' AND rc_user_text = ' . $dbo->addQuotes( $title->getText() ); + } else { + return ''; + } } } @@ -152,16 +158,18 @@ class NewPagesPage extends QueryPage { Xml::namespaceSelector( intval( $this->namespace ), 'all' ) . " - + " . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . " " . Xml::input( 'username', 30, $this->username, array( 'id' => 'mw-np-username' ) ) . " - - - + + " . Xml::checkLabel( wfMsgHtml( 'rcshowhideliu', wfMsg( 'hide' ) ), + 'hideliu', 'hideliu', $this->hideliu, array( 'id' => 'mw-np-hideliu' ) ) . " + + " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . " @@ -179,7 +187,7 @@ class NewPagesPage extends QueryPage { * @return array */ function linkParameters() { - return( array( 'namespace' => $this->namespace, 'username' => $this->username ) ); + return( array( 'namespace' => $this->namespace, 'username' => $this->username, 'hideliu' => $this->hideliu ) ); } } @@ -193,12 +201,15 @@ function wfSpecialNewpages($par, $specialPage) { list( $limit, $offset ) = wfCheckLimits(); $namespace = NS_MAIN; $username = ''; + $hideliu = false; if ( $par ) { $bits = preg_split( '/\s*,\s*/', trim( $par ) ); foreach ( $bits as $bit ) { if ( 'shownav' == $bit ) $shownavigation = true; + if ( 'hideliu' == $bit ) + $hideliu = true; if ( is_numeric( $bit ) ) $limit = $bit; @@ -219,12 +230,15 @@ function wfSpecialNewpages($par, $specialPage) { $namespace = $ns; if( $un = $wgRequest->getText( 'username' ) ) $username = $un; + if( $hliu = $wgRequest->getBool( 'hideliu' ) ) + $hideliu = $hliu; + } if ( ! isset( $shownavigation ) ) $shownavigation = ! $specialPage->including(); - $npp = new NewPagesPage( $namespace, $username ); + $npp = new NewPagesPage( $namespace, $username, $hideliu ); if ( ! $npp->doFeed( $wgRequest->getVal( 'feed' ), $limit ) ) $npp->doQuery( $offset, $limit, $shownavigation ); -- 2.20.1